{? if $topics|@is_array ?}
{?* 传递的参数格式正确,为一个数组 *?}

<div id="topic_list">
<div id="controler"><a href="post_new_topic.php">Post new topic.</a></div>

{? foreach key=key item=item from=$topics ?}

<div class="topic">
	
	{? foreach key=key item=item from=$item ?}
	{?* 取出主题中的信息 *?}

	{? if $key == 'topic_no' ?}
		{? assign var=topic_no value=$item ?}
	{? /if ?}

	{? if $key == 'title' ?}
		{? assign var=title value=$item ?}
	{? /if ?}
	
	{? if $key == 'content' ?}
	{?* 需要对内容进行一个摘要处理 *?}
		{? assign var=summary value=$item|truncate:150:"...":true ?}
	{? /if ?}

	{? if $key == 'username' ?}
		{? assign var=username value=$item ?}
	{? /if ?}

	{? if $key == 'problem_no'?}
		{? assign var=problem_no value=$item ?}
	{? /if ?}

	{? if $key == 'post_time' ?}
	{?*用户发表该主题的时间显示时格式需要处理*?}
		{? assign var=post_time value=$item|date_format:"%A, %B %e, %H:%M:%S, %Y" ?}
	{? /if ?}
		
	{? if $key == 'view_count' ?}
		{? assign var=view_count value=$item ?}
	{? /if ?}

	{? if $key == 'reply_count' ?}
		{? assign var=reply_count value=$item ?}
	{? /if ?}

	{? /foreach ?}
	<!--title-->
	<div class="title"><a href="topic_detail.php?topic_no={? $topic_no ?}" >{? $title ?}</a></div>

	<!--info-->
	<div class="info">
		Postd in {? $post_time ?} and 
		viewed {? $view_count ?} times,
		reply {? $reply_count ?} times .
	</div>
					
	<!--post_ower-->
	<div class="topic_ower">{? $username ?}</div>
			
	<!--summary-->
	<div class="summary">
		{? $summary ?}
	</div>
		
	<!--tags-->
	<div class="tags"><a href="#" class="button">{? $problem_no ?}</a></div>
</div>

{? /foreach ?}

<div id="pager">{? $links ?}</div>

</div>

{? else ?}
{?* 传递函数格式不正确 *?}
	
	No topic yet....

{? /if ?}
